# Maintainer:
# Contributor: Eric Bélanger <eric@archlinux.org>

pkgname=a2ps
pkgver=4.15.4
pkgrel=1
pkgdesc="An Any to PostScript filter"
arch=('x86_64')
url="https://www.gnu.org/software/a2ps/"
license=('GPL3')
depends=('psutils' 'imagemagick' 'perl')
makedepends=('gperf')
backup=('etc/a2ps/a2ps.cfg' 'etc/a2ps/a2ps-site.cfg')
source=(https://ftp.gnu.org/gnu/a2ps/${pkgname}-${pkgver}.tar.gz{,.sig}
        a2ps-4.13c-emacs.patch
        a2ps-adhere-source-date-epoch.patch)
sha256sums=('4a063f84ba89d86be14a6704ca35fd130083b572f1376b439a1b79b67b206dd7'
            'SKIP'
            '943739a788db47f10942477754f42c8c9b22cdaad4463bea4103c31a330de76a'
            '305ba7b9a44e7d6480a23098efb27aab5daedde71defcfe2f1b01b70d025e3db')
validpgpkeys=('24093F016FFE8602EF449BB84C8EF3DA3FD37230') # Reuben Thomas <rrt@sc3d.org>

prepare() {
  cd ${pkgname}-${pkgver}
  patch -p1 -i "${srcdir}/a2ps-4.13c-emacs.patch"
  patch -p1 -i "${srcdir}/a2ps-adhere-source-date-epoch.patch"
}

build() {
  cd ${pkgname}-${pkgver}
  libtoolize --force --copy
  autoreconf --force --install -I m4 
  LIBS+="-lm" ./configure --prefix=/usr --sysconfdir=/etc/a2ps \
    --includedir=/usr/include --enable-shared --enable-nls
  make
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
}
